1 <?php
2 session_start();
3 $username=
"root";
4 $servername=
"localhost";
5 $dbname=
"studentinfo";
6 $con=mysqli_connect($servername,$username,
"",$dbname);
7 if
($con->connect_error){
8     die(
"Connection failed:"+$con->connect_error);
9 }
10 $table=$_SESSION[
'tsub'];
11 $stmt=$con->prepare(
"insert into $table (reg_id,ut1,ut2,ut3) values(?,?,?,?)");
12 $stmt->bind_param(
"iiii",$id,$ut1,$ut2,$ut3);
13
14     $id=$_SESSION[
'rid'];
15 $ut1=$_SESSION[
'unit1'];
16 $ut2=$_SESSION[
'unit2'];
17 $ut3=$_SESSION[
'unit3'];
18 $stmt->execute();
19 $sql=
"select * from $table";
20 $result=$con->query($sql);

21 if
($result->num_rows > 0) {
22     echo
"<table><tr><th>ID</th><th>UT1</th><th>UT2</th><th>UT3></th></tr>";
23     
// output data of each row
24     
while($row = $result->fetch_assoc()) {
25         echo
"<tr><td>".$row["reg_id"]."</td><td>".$row["ut1"]." ".$row["ut2"]." ".$row["ut3"]."</td></tr>";
26     }
27     echo
"</table>";
28 }

29 else
{
30     echo
"0 results";
31 }
32 ?>


Gõ tìm kiếm nhanh...